package org.ms.nerver.governor;

import org.zbus.kit.log.Logger;

public enum Governor {

	INSTANCE;

	private Logger logger = Logger.getLogger(Governor.class);

	public void start() throws Exception {
		try {
			if (logger.isInfoEnabled()) {
				logger.info("Is startting, please waitting..");
			}

			if (logger.isInfoEnabled()) {
				logger.info("Started is successed.");
			}
		} catch (Throwable t) {
			logger.error("Started is fail, error is: " + t.getMessage(), t);
			t.printStackTrace();
		}
	}

	/**
	 * 
	 * @throws Exception
	 */
	public void destroy() {
		try {
			if (logger.isInfoEnabled()) {
				logger.info("Is destroiing, please waitting..");
			}

			if (logger.isInfoEnabled()) {
				logger.info("Destroied is successed.");
			}
		} catch (Throwable t) {
			logger.error("Destroied is fail, error is: " + t.getMessage(), t);
			t.printStackTrace();
		}
	}

	public static void main(String[] args) {
		try {
			INSTANCE.start();
		} catch (Exception e) {
			INSTANCE.destroy();
			e.printStackTrace();
		}
	}

}
